{block name="title" prepend}{$LNG.lm_buildings}{/block}
{block name="content"}
{if !empty($Queue)}
<div id="buildlist" class="buildlist">
	<table style="width:760px">
		{foreach $Queue as $List}
		{$ID = $List.element}
		<tr>
			<td style="width:70%;vertical-align:top;" class="left">
				{$List@iteration}.: 
				{if !($isBusy.research && ($ID == 6 || $ID == 31)) && !($isBusy.shipyard && ($ID == 15 || $ID == 21)) && $RoomIsOk && $CanBuildElement && $BuildInfoList[$ID].buyable}
				<form class="build_form" action="game.php?page=buildings" method="post">
					<input type="hidden" name="cmd" value="insert">
					<input type="hidden" name="building" value="{$ID}">
					<button type="submit" class="build_submit onlist">{$LNG.tech.{$ID}} {$List.level}{if $List.destroy} {$LNG.bd_dismantle}{/if}</button>
				</form>
				{else}{$LNG.tech.{$ID}} {$List.level} {if $List.destroy}{$LNG.bd_dismantle}{/if}{/if}
				{if $List@first}
				<br><br><div id="progressbar" data-time="{$List.resttime}"></div>
			</td>
			<td>
				<div id="time" data-time="{$List.time}"><br></div>
				<form action="game.php?page=buildings" method="post" class="build_form">
					<input type="hidden" name="cmd" value="cancel">
					<button type="submit" class="build_submit onlist">{$LNG.bd_cancel}</button>
				</form>
				{else}
			</td>
			<td>
				<form action="game.php?page=buildings" method="post" class="build_form">
					<input type="hidden" name="cmd" value="remove">
					<input type="hidden" name="listid" value="{$List@iteration}">
					<button type="submit" class="build_submit onlist">{$LNG.bd_cancel}</button>
				</form>
				{/if}
				<br><span style="color:lime" data-time="{$List.endtime}" class="timer">{$List.display}</span>
			</td>
		</tr>
	{/foreach}
	</table>
</div>
{/if}
<table style="width:780px">
<tr><td colspan="3" style="border:#333 1px solid; border-radius:2px; background:none"><div id="poli" style="width:{$raz}%"><span>
 Поля: <a style="cursor:help;" title="Занято полей на планете">{$planet_field_current}</a> / <a style="cursor:help;" title="Количество полей на планете">{$planet_field_max}</a> Свободно: <a style="color:#FC0">{$planet_field_max - $planet_field_current}</a></span></div>
        </td>
    </tr>
  	{$td=3}
	{foreach $BuildInfoList as $ID => $Element}
        {if $td==3}
            <tr>
                <td width="260px">
             {$td=0}
         {else} 
         	<td width="260px">
         {/if}      
            {$td= $td +1}
	<table class="b_box">
      <tr>
		<td rowspan="2" style="width:75px;">
			<a href="#" onclick="return Dialog.info({$ID})">
				<img src="{$dpath}gebaeude/{$ID}.gif" alt="{$LNG.tech.{$ID}}" width="75" height="75">
			</a>
		</td>
		<td>
			<a href="#" onclick="return Dialog.info({$ID})">{$LNG.tech.{$ID}}<br />{if $Element.level > 0} ({$LNG.bd_lvl} {$Element.level}{if $Element.maxLevel != 255}/{$Element.maxLevel}{/if}){/if} </a> 
            
		</td>
	</tr>
	<tr style="padding:0;">
		<td>
        	<div style="width:100%; text-align: left;">
                <span style="display:block; clear:both; text-align: left">
                    Время: {$Element.elementTime|time}
                </span>
                <span style="float:left; display:block;">
                        {if $Element.maxLevel == $Element.level}
                            <span style="color:red">{$LNG.bd_maxlevel}</span>
                        {elseif ($isBusy.research && ($ID == 6 || $ID == 31)) || ($isBusy.shipyard && ($ID == 15 || $ID == 21))}
                            <span style="color:red">{$LNG.bd_working}</span>
                        {else}
                            {if $RoomIsOk}
                                {if $CanBuildElement && $Element.buyable}
                                <form action="game.php?page=buildings" method="post" class="build_form">
                                    <input type="hidden" name="cmd" value="insert">
                                    <input type="hidden" name="building" value="{$ID}">
                                    <button type="submit" class="build_submit">
                                        Улучшить до {$Element.level + 1}
                                    </button>
                                </form>
                                {else}
                                <span style="color:red">
                                    Улучшить до {$Element.level + 1}
                                </span>
                                {/if}
                            {else}
                                <span style="color:red">
                                    {$LNG.bd_no_more_fields}
                                </span>
                            {/if}
                        {/if}
                  </span>
      		{if $Element.level > 0}
                <span style="float:right; display:block;">
				{if ($ID == 44 && !$HaveMissiles) ||  $ID != 44}
                	<a style="font-size:12px; font-weight:bold; color:#F00;" class="tooltip_sticky" data-tooltip-content="<table style='width:300px'><tr><th colspan='2'>{$LNG.bd_price_for_destroy} {$LNG.tech.{$ID}} {$Element.level}</th></tr>{foreach $Element.destroyRessources as $ResType => $ResCount}<tr><td>{$LNG.tech.{$ResType}}</td><td>{$ResCount|number}</td></tr>{/foreach}<tr><td>{$LNG.bd_destroy_time}</td><td>{$Element.destroyTime|time}</td></tr><tr><td colspan='2'><form action='game.php?page=buildings' method='post' class='build_form'><input type='hidden' name='cmd' value='destroy'><input type='hidden' name='building' value='{$ID}'><button type='submit' class='build_submit onlist'>{$LNG.bd_dismantle}</button></form></td></tr></table>">x</a>
               {/if}
           		</span>
              
         	 	{if $ID == 43}
                    <span style="display:block; clear:both; text-align:center">
                        <a href="#" onclick="return Dialog.info({$ID})">{$LNG.bd_jump_gate_action}</a> 
                    </span>
                {/if}
            {/if}            	
			</div>
		</td>
	</tr>
	<tr>
		<td colspan="2" style="margin-bottom:10px;">  
			<table style="width:100%">
				<tr>
					
                        {foreach $Element.costRessources as $RessID => $RessAmount}
                        <td class="transparent">                       
                            <img src="{$dpath}images/{$RessID}.gif" alt="{$LNG.tech.{$RessID}}" height="25" /><br />
                                <span style="font-weight:bold; color:{if $Element.costOverflow[$RessID] == 0}lime{else}red{/if}">
                                   	{$RessAmount|number}
                                </span>
						</td>
                        {/foreach}
				</tr>
			</table>
		</td>
	  </tr>
               {if !empty($Element.infoEnergy)}
                            <tr>
                            	<td colspan="2">
                        			{$Element.infoEnergy}
                                </td>
                            </tr>
                            {/if}
    </table>
    {if $td==3}
        </td>
    </tr>
    {else} 
        </td>
    {/if} 
	{/foreach}
        {if $td!=3}
    </tr>
    {/if}
	<tr>
    	<td class="transparent" style="text-align:left" colspan="3">
        	<a href="game.php?page=buildings&amp;mode=inter">Классический вид</a>
            <br /> Мгновенная покупка за Темную материю <a href="game.php?page=dmbuild">[Построек]</a>
        </td>
    </tr>
</table>
{/block}